package com.gelsanalyzer.ui.swing;

import java.awt.event.*;

import javax.swing.*;

import com.gelsanalyzer.core.*;

public class CourseMgmtMenuBar extends JMenuBar {
    // Store the commands that we will need to manipulate. For each of these 
    // commands, we will have accessors so that the implementing controller can
    // get references to them.
    private JMenuItem fileMenuSave;
    private JMenuItem fileMenuExit;
    private JMenuItem editMenuAddCourse;
    private JMenuItem editMenuRemoveCourse;

    public CourseMgmtMenuBar() {
        // Start by creating the File option...
        JMenu fileMenu = new JMenu("File", true);
        fileMenu.setMnemonic(KeyEvent.VK_F);
        // Next create the Edit option...
        JMenu editMenu = new JMenu("Edit", true);
        editMenu.setMnemonic(KeyEvent.VK_E);

        // Initialize the Command objects for the MenuBar here:
        fileMenuSave = new JMenuItem(ActionFactory.getSaveAction());//"Save", parentFrame);
        fileMenuExit = new JMenuItem(ActionFactory.getExitAction());//"Exit", parentFrame);

        editMenuAddCourse = new JMenuItem(ActionFactory.getAddCourse());//new AddCourseCommand("Add Course", parentFrame);
        editMenuAddCourse.setEnabled(false);
        
        editMenuRemoveCourse = new JMenuItem(ActionFactory.getRemoveCourse());
        editMenuRemoveCourse.setEnabled(false);

        // Add the listeners to the MenuItems
//        fileMenuExit.addActionListener(parentFrame);
//        fileMenuSave.addActionListener(parentFrame);
        
        //editMenuAddCourse.addActionListener(parentFrame);
        
        // Temporarily disable items...
        fileMenuSave.setEnabled(false);
        
        // Add the actual Command objects to the menu
        fileMenu.add(fileMenuSave);
        fileMenu.add(fileMenuExit);

        editMenu.add(editMenuAddCourse);
        editMenu.add(editMenuRemoveCourse);

        //Add the actual Menu to the MenuBar
        this.add(fileMenu);
        this.add(editMenu);
    }

    public JMenuItem getFileSaveMenuItem() {
        return fileMenuSave;
    }

    public JMenuItem getFileExitMenuItem() {
        return fileMenuExit;
    }

    public JMenuItem getEditAddCourseMenuItem() {
        return editMenuAddCourse;
    }

}
